package portal.web.servlets;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.log4j.Logger;


import portal.facade.PortalComprasFacadeStateful;


import portal.vo.ConfigVO;

import portal.web.businessDelegate.PortalComprasDelegate;


@SuppressWarnings("serial")
public class ConfigListServlet extends HttpServlet {
	
	private static Logger logger = Logger.getLogger(AutenticarUsuarioServlet.class);	
	
	final String appName = "PortalDeComprasEAR";
    final String moduleName = "PortalDeComprasSrv";
    final String sessionBeanNameStateful = "PortalComprasFacadeStatefulBean";
    final String viewClassNameStateful = PortalComprasFacadeStateful.class.getName();
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		processRequest(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		processRequest(req, resp);
	}

	private void processRequest(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		
		//logger.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>ConfigListServlet<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
		
		List<ConfigVO> listado = new ArrayList<ConfigVO>();	
		
	
		listado = PortalComprasDelegate.getInstance().getListaConfiguraciones();

		
		req.setAttribute("listaConfigs", listado);
		
		req.getRequestDispatcher("/jsp/config.jsp").forward(req, resp);

		
		
		
	}
		
		
}
	